<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/template/mainTemplate.xhtml">
	<ui:define name="titulo">
		<h:outputLabel value="#{msg.registroUsuario}" />
	</ui:define>
	<ui:define name="cont">
		<p:panel id="painelCadastro" header="#{msg.novo} #{msg.user} - MusicBay">
			<h:form>
				<h:panelGrid columns="3" cellpadding="7">
					<h:outputLabel value="#{msg.nome}" for="nome" class="label" />
					<h:panelGroup>
						<p:inputText value="#{usuarioManagedBean.usuario.nome}" id="nome" label="nome" required="true"
							size="30" maxlength="30" requiredMessage="#{msg.nome} #{msg.naoInformado}">
							<f:validateLength minimum="2" maximum="30" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="nome" />

					<h:outputLabel value="#{msg.unome}" for="sobrenome" class="label" />
					<h:panelGroup>
						<p:inputText value="#{usuarioManagedBean.usuario.sobrenome}" id="sobrenome"
							label="#{msg.unome}" required="true" size="60"
							requiredMessage="#{msg.unome} #{msg.naoInformado}">
							<f:validateLength minimum="2" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="sobrenome" />

					<h:outputLabel value="#{msg.nascimento}" for="ptCal" class="label" />
					<h:panelGroup>
						<p:calendar locale="pt" showButtonPanel="true" navigator="true" id="ptCal" required="true"
							yearRange="1900" pattern="dd/MM/yyyy" value="#{usuarioManagedBean.usuario.nascimento}"
							requiredMessage="#{msg.invalido}: #{msg.nascimento}">
						</p:calendar>
					</h:panelGroup>
					<p:message for="ptCal" />

					<h:outputLabel value="#{msg.sexo}" for="sexo" class="label" />
					<h:panelGroup>
						<p:selectOneRadio value="#{usuarioManagedBean.usuario.sexo}" id="sexo" label="#{msg.sexo}"
							required="true" requiredMessage="#{msg.invalido}: #{msg.sexo}" styleClass="label">
							<f:selectItem itemLabel="#{msg.masculino}" itemValue="M" />
							<f:selectItem itemLabel="#{msg.feminino}" itemValue="F" />
						</p:selectOneRadio>
					</h:panelGroup>
					<p:message for="sexo" />

					<h:outputLabel value="CPF" for="cpf" class="label" />
					<h:panelGroup>
						<p:inputMask value="#{usuarioManagedBean.usuario.cpf}" mask="999.999.999-99" id="cpf"
							label="CPF" required="true" size="15" requiredMessage="CPF #{msg.naoInformado}">
							<f:validator for="cpf" validatorId="validatorCpf" />
						</p:inputMask>
					</h:panelGroup>
					<p:message for="cpf" />

					<h:outputLabel value="E-mail" for="email" class="label" />
					<h:panelGroup>
						<p:inputText value="#{usuarioManagedBean.usuario.email}" id="email" label="email" size="25"
							required="true" requiredMessage="#{msg.invalido}: E-mail">
							<f:validateRegex pattern="[a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+" />
							<f:validator for="email" validatorId="validatorEmail" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="email" />

					<h:outputLabel value="Login" for="login" class="label" />
					<h:panelGroup>
						<p:inputText value="#{usuarioManagedBean.usuario.login}" id="login" label="Login"
							required="true" size="23" requiredMessage="#{msg.invalido}: Login">
							<f:validator for="login" validatorId="validatorLogin" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="login" />

					<h:outputLabel value="#{msg.senha}" for="senha1" class="label" />
					<h:panelGroup>
						<p:password id="senha1" value="#{usuarioManagedBean.usuario.senha}" match="senha2"
							label="senha1" required="true" requiredMessage="#{msg.informe} #{msg.senha}" />
					</h:panelGroup>
					<p:message for="senha1" />

					<h:outputLabel value="#{msg.repita} #{msg.senha}" for="senha2" class="label" />
					<h:panelGroup>
						<p:password id="senha2" value="#{usuarioManagedBean.usuario.senha}" label="senha2"
							required="true" requiredMessage="#{msg.repita} #{msg.senha}" />
					</h:panelGroup>
					<p:message for="senha2" />
				</h:panelGrid>

				<p:commandButton id="save" value="#{msg.cadastrar}" action="#{usuarioManagedBean.actionSave}"
					ajax="false" styleClass="buttonCadastro" icon="ui-icon-check" />

			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>
</html>